/**
 * 
 */
package dms.service.imp;

import dms.model.Classes;
import dms.model.Dormitory;
import dms.model.School;
import dms.model.role.Student;
import dms.model.util.PageIterator;
import dms.repository.StudentRepository;
import dms.service.StudentQueryService;

/**
 * @author 李健
 *
 */
public class StudentQueryServiceImpl implements StudentQueryService {

	private StudentRepository studentRepository = null;
	
	/**
	 * @param studentRepository
	 */
	public StudentQueryServiceImpl(StudentRepository studentRepository) {
		super();
		this.studentRepository = studentRepository;
	}

	/**
	 * @return the studentRepository
	 */
	public StudentRepository getStudentRepository() {
		return studentRepository;
	}

	/**
	 * @param studentRepository the studentRepository to set
	 */
	public void setStudentRepository(StudentRepository studentRepository) {
		this.studentRepository = studentRepository;
	}

	@Override
	public PageIterator<Student> findAll(int start, int count) {
		return this.studentRepository.findAll(start, count);
	}

	@Override
	public PageIterator<Student> findByClasses(Classes classes, int start,
			int count) {
		return this.studentRepository.findByQuery(start, count, classes.getName());
	}

	@Override
	public PageIterator<Student> findByDormitory(Dormitory dormitory,
			int start, int count) {
		return this.studentRepository.findByDormitory(start, count, dormitory);
	}

	@Override
	public PageIterator<Student> findByQuery(int start, int count, String query) {
		return this.studentRepository.findByQuery(start, count, query);
	}

	@Override
	public PageIterator<Student> findBySchool(School school, int start,
			int count) {
		return this.studentRepository.findByQuery(start, count, school.getName());
	}

	@Override
	public Student findById(long id) {
		return this.studentRepository.findById(id);
	}

	/**
	 * 
	 */
	public StudentQueryServiceImpl() {
		super();
	}

}
